<?php
/**
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
 * @license    GNU/GPL
*/
 
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
 
// Require the base controller
 
require_once( JPATH_COMPONENT.DS.'controller.php' );
 
// Require specific controller if requested
if($controller = JRequest::getWord('controller')) {
    $path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php';
    if (file_exists($path)) {
        require_once $path;
    } else {
        $controller = '';
    }
}
 
// Create the controller
$classname    = 'HizkuntzakController'.$controller;
$controller   = new $classname( );

$user =& JFactory::getUser();

// Perform the Request task
$task = JRequest::getWord( 'task' );

//Control admin part and users permisions
if (($task == "addLang" ||
	$task == "addNumbersLang" ||
	$task == "addSongLang" ||
	$task == "addWord" ||
	$task == "addWordsLang" ||
	$task == "createLang" ||
	$task == "createNumbersLang" ||
	$task == "createSongLang" ||
	$task == "createWord" ||
	$task == "createWordsLang" ||
	$task == "createQasLang" ||
	$task == "createQa" ||
	$task == "adminHizkuntzak") &&
	$user->id == 0){
		$link = 'index.php?option=com_hizkuntzak';
		JApplication::redirect($link, $msg='', $msgType='message');			
}

$controller->execute( JRequest::getWord( 'task' ) );

 
// Redirect if set by the controller
$controller->redirect();

